package com.controller;

import com.model.Business;
import com.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("elm/BusinessController")
public class BusinessController {
      @Autowired
      BusinessService service;

      @PostMapping("/listBusinessByOrderTypeId")
      public Object listBusinessByOrderTypeId(Business business)throws Exception{
        //调用service的方法
        List<Business> list = service.listBusinessByTypeId(business.getOrderTypeId());
        return list;
      }

      @PostMapping("/getBusinessById")
      public Object getBusinessById(Integer businessId)throws Exception{
        Business business = service.getBusinessById(businessId);
        return business;
      }

}
